package cn.template.services;

import cn.template.models.common.JwtUser;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

@Service
public class JwtUserService implements UserDetailsService {
    private final UserService repository;

    public JwtUserService(UserService repository) {
        this.repository = repository;
    }

    @Override
    public JwtUser loadUserByUsername(String username) throws UsernameNotFoundException {
        return this.repository.getByUsername(username);
    }
}